package com.weixing.mall.provider.api.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.weixing.mall.base.orm.MPage;
import com.weixing.mall.base.wrapper.Result;
import com.weixing.mall.provider.api.fallback.ItemFeignFallback;
import com.weixing.mall.provider.api.model.dto.GoodPrintRpcDto;
import com.weixing.mall.provider.api.model.query.ActGoodsQuery;
import com.weixing.mall.provider.api.model.query.ErpGoodsQuery;
import com.weixing.mall.provider.api.model.vo.ActivityProductVo;
import com.weixing.mall.provider.api.model.vo.ErpProductVo;
import com.weixing.mall.provider.api.model.vo.ItemVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.ribbon.FeignRibbonClientAutoConfiguration;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @Author: kfc
 * @Description: <br/>
 * Date:Create in 2019/10/9 15:49
 * @Modified By:
 */
@FeignClient(value = "mall-provider-goods", configuration = FeignRibbonClientAutoConfiguration.class, fallback = ItemFeignFallback.class)
public interface ItemFeign {

    @GetMapping("/api/product/findActProductVoByIds")
    Result<List<ActivityProductVo>> findActProductVoByIds(@RequestParam(value = "productIds") long[] productIds);

    @GetMapping("/api/product/findProductVoByProductSn")
    Result<ItemVo> findProductVoByProductSn(@RequestParam(value = "productSn") String productSn);

    @GetMapping("/api/product/findActProductVo")
    Result<List<ActivityProductVo>> findActProductVo(@RequestBody ActGoodsQuery goodsQuery);

    @GetMapping("/api/product/findByGoodsn")
    Result<List<ActivityProductVo>> findByGoodsn(@RequestParam(value = "goodSn") String goodSn);

    @GetMapping("/api/product/findProductVo")
    Result<List<ActivityProductVo>> findProductVo(ActGoodsQuery goodsQuery);
    @GetMapping("/api/product/printGoods")
    Result  printGoods(@RequestBody List<GoodPrintRpcDto> goodPrintRpcDto);
    @GetMapping("/api/product/findProductVoByCreatedId")
    Result<IPage<ActivityProductVo>> findProductVoByCreatedId(Page page, @RequestParam(value = "createdById") Long createdById);

    @GetMapping("/api/product/findById")
    Result<ItemVo> findById(@RequestParam(value = "itemId") Long itemId);

    /**
     * 入库单调用
     *
     * @return
     */
    @GetMapping("/api/product/selectProduct")
    List<ItemVo> selectProduct();


    /**
     * 根据货号来查询
     *
     * @return
     */
    @GetMapping("/api/product/getBygoodSn")
    List<ItemVo> getBygoodSn(@RequestParam(value = "goodSn") String goodSn);

    /**
     * 出库单调用
     * @param goodsQuery
     * @return
     */
    @PostMapping("/api/product/getErpGoodsList")
    Result<MPage<ErpProductVo>> getErpGoodsList(@RequestBody ErpGoodsQuery goodsQuery);
}
